﻿@{
    ViewBag.PageTitle = "首页";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@using Dukou;
@using Dukou.Javascript;
@using MvcApp.Models;
@using Dukou.Web.Layout;

<pre style="width: 100%; height: 500px;">
@using (Js js = new Js(Html))
{
    var var1 = js.Var("val", new { 
        title = "matt.fang", 
        age = 4, 
        parent = new { title = "bin.fang", age = 30 }, 
        children = new List<object>() { 
            new { name = "lu.fang" }, 
            new { name = "lv.fang", age = 8  } 
        } 
    });

    var var2 = js.Var("val", new List<object>(){ new { title = "matt.fang", age = 4, parent = new { title = "bin.fang", age = 30 } }});
    
    //xx(var2.Value["parent"]["age"])
    
    var d = js.Var("d", var2.Value);
    var a = js.Var("a", 1);
    var b = js.Var("b", 2);
    var c = js.Var("c", "123");
    var e = js.Var("e", b);
    var f = js.Var("f", JsValue.Create(null));
    js.Assign(a, 4);
    js.Assign(a, "3434");
    js.Assign(a, new { name = "34" });
    js.Assign(a, c);
    using (js.if_(JsExpr.And(a, JsExpr.Or(JsExpr.Eq(a, "34"), JsExpr.Eq(b, c))))) 
    {
        JsExpr.And(a, 34);
       
    }
    using (js.else_if(JsExpr.Eq(a, b)))
    {
        js.Assign(a, JsExpr.Plus(1, 2));

        js.Var("a", JsExpr.Mul(a, d));
    }
    using (js.else_())
    {
        
    }
    
    
    
}
</pre>

<div>
    @Html.DropDownList("Gender", typeof(MvcApp.Models.Gender))<br/>
    @Html.DropDownList("Gender", typeof(MvcApp.Models.Gender), MvcApp.Models.Gender.Female)<br/>
    @Html.DropDownList("Gender3", typeof(MvcApp.Models.Gender), null, "-请选择-")<br/>
    @Html.DropDownList("Gender3", typeof(MvcApp.Models.Gender), null, null)<br/>
    @Html.DropDownList("Gender3", typeof(MvcApp.Models.Gender), MvcApp.Models.Gender.Female, "-全部-", new { style = "width: 100px" })<br/>

    @{
        
        string[] a3 = new string[] { "1" };

    }



</div>
@{
    var html = "@Html.Encode(123)";
}
<div>
    @Html.Raw(html)

</div>

@{
    var c2 = new Container()
    {
        FloatType = FloatType.Left,
        Width = 800,
    }; 
    
    var c3 = new Container()
    {
        FloatType = FloatType.Right,
        Width = 200,
    };

    Container c1 = new Container()
    {
        FloatType = FloatType.None,
        Width = 1000,
        Left = c2,
        Right = c3
    };

    IList<Widget> widgets = new List<Widget>()
    { 
        new Widget() { Name = "left", ViewName = "UserList" }, 
    };

    c2.Widgets = widgets;
    c3.Widgets = new List<Widget>() 
    {
        new Widget(){ ControllerName = "Home", ActionName = "WelcomeBar" }
    };
}
@Html.Render(c1)
<script type="text/javascript">
    var a = undefined;
</script>